import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StrokeUserVO, StrokeUserForm, StrokeUserQuery } from '@/api/stroke/strokeUser/types';

/**
 * 查询stroke用户信息列表
 * @param query
 * @returns {*}
 */

export const listStrokeUser = (query?: StrokeUserQuery): AxiosPromise<StrokeUserVO[]> => {
  return request({
    url: '/stroke/strokeUser/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询stroke用户信息详细
 * @param userId
 */
export const getStrokeUser = (userId: string | number): AxiosPromise<StrokeUserVO> => {
  return request({
    // url: '/stroke/strokeUser/' + userId,
    url: '/stroke/strokeUser',
    method: 'get',
    params: { userId }
  });
};

/**
 * 新增stroke用户信息
 * @param data
 */
export const addStrokeUser = (data: StrokeUserForm) => {
  return request({
    url: '/stroke/strokeUser',
    method: 'post',
    data: data
  });
};

/**
 * 修改stroke用户信息
 * @param data
 */
export const updateStrokeUser = (data: StrokeUserForm) => {
  return request({
    url: '/stroke/strokeUser',
    method: 'put',
    data: data
  });
};

/**
 * 删除stroke用户信息
 * @param userId
 */
export const delStrokeUser = (userId: string | number | Array<string | number>) => {
  return request({
    url: '/stroke/strokeUser/' + userId,
    method: 'delete'
  });
};
